﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using CTP.Entitys;

namespace CTP.ComWrap
{
    [ComVisible(false)]
    public delegate void OnQueryPositionHandle(QueryPositionEventArgs e);

    [Guid("fada807b-dc38-4792-becc-cce1806b5ba1")]
    public interface IQueryPositionEventArgs
    {
        ReturnInfo ReturnInfo { get; set; }
        PositionInformation[] Positions { get; set; }
        int RequestID { get; set; }
        int RecordCount { get; }
        PositionInformation Get(int index);
    }

    [Guid("d4406705-0dcb-4a7e-88cd-615f8d552cff")]
    [ClassInterface(ClassInterfaceType.None)]
    public class QueryPositionEventArgs : EventArgs, IQueryPositionEventArgs
    {
        public PositionInformation[] Positions { get; set; }
        public ReturnInfo ReturnInfo { get; set; }
        public int RequestID { get; set; }
        public int RecordCount { get { return Positions.Length; } }
        public PositionInformation Get(int index)
        {
            if (Positions == null || Positions.Length < 1 || index < 0 || index >= Positions.Length)
                return new PositionInformation();

            return Positions[index];
        }
    }

}
